package com.artist.service.Impl;

import com.artist.entity.TbDepartment;
import com.artist.mapper.TbDepartmentMapper;
import com.artist.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service("departmentService")
public class DepartmentServiceImpl  implements DepartmentService {
    @Autowired
    private TbDepartmentMapper departmentMapper;
    @Override
    public List<TbDepartment> selectAll() {
        List<TbDepartment> list =departmentMapper.selectAll();
        return list;
    }

    @Override
    public TbDepartment selectDepartmentById(Integer did) {
        return departmentMapper.selectByPrimaryKey(did);
    }

    @Override
    public void saveDepartment(TbDepartment department) {
        departmentMapper.insert(department);
    }

    @Override
    public int deleteDepartment(Integer did) {
       return departmentMapper.deleteByPrimaryKey(did);
    }

    @Override
    public int updateByPrimaryKeySelective(TbDepartment record) {

        return departmentMapper.updateByPrimaryKeySelective(record);
    }
}
